package com.gitee.elf.module.kether

import com.gitee.elf.core.entity.EntityInstance
import com.gitee.elf.core.entity.MetadataContainer
import taboolib.module.kether.ScriptFrame
import kotlin.jvm.optionals.getOrNull

const val NAMESPACE = "elf-entity"

fun ScriptFrame.getEntityMetadataContainer(): MetadataContainer {
    return getEntityInstance().metadataContainer
}

fun ScriptFrame.getEntityInstance(): EntityInstance {
    return this.variables().get<EntityInstance>("@EntityInstance").getOrNull() ?: error("No @EntityInstance")
}